package com.ethan.rabbitackproduce;

import com.rabbitmq.client.AMQP;
import org.springframework.amqp.core.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class RabbitConfig {

    public static final String QUEUE_NAME="queue_topic_ack";
    public static final String EXCHANGE_NAME="ethan_exchange_topic";
    @Bean
    public Queue queue(){
        return QueueBuilder.durable(QUEUE_NAME).build();
    }
    @Bean
    public Exchange exchange(){
        return ExchangeBuilder.topicExchange(EXCHANGE_NAME).build();
    }
    @Bean
    Binding bing(Queue queue,Exchange exchange){
        return BindingBuilder.bind(queue).to(exchange).with("ethan.#").noargs();
    }
}
